package org.istt.dao;

import java.util.List;

import org.istt.domain.AttachFile;
import org.istt.domain.Category;
import org.istt.domain.CategoryType;


public interface AttachFileDao extends Dao<AttachFile, Long> {
    public List<AttachFile> getAttachFiles();
    public AttachFile getAttachFile(Long attachFileId);
    public void saveAttachFile(AttachFile attachFile);
    public void removeAttachFile(Long attachFileId);
    public List<AttachFile> searchAttachFile(String attachFileName, Category category, CategoryType categoryType);
    
    /**
     * Find all the attach file belong to a category
     * @param cateId Category ID
     * @return the list of attach file
     */
    List<AttachFile> findByCateId(Long cateId);
    
    /**
     * Find all the attachment file belong to a category and category type
     * @param cateId Category ID
     * @param categoryTypeId CategoryType ID
     * @return the list of attach file
     */
    List<AttachFile> findAttachFile(Long categoryId,Long cagegoryTypeId);
    
    /**
     * 
     * @param categoryId
     * @param categoryTypeId
     * @return
     */
    List<AttachFile> findByCatIdAndCatTypeId(Long categoryId, Long categoryTypeId);
    boolean isUnique(String[] fields, String[] value, Long id, Long cateId, Long cateTypeId, Long docTypeId);
    
    int countFileUseAttach(Long attachFileId);
    
    public int getRecordCount(Long categoryId, Long categoryTypeId, Long documentTypeId);
    
}
